/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2020年1月3日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.practice;

/**
 * @Type A20200103_sigleton_doubleCheck
 * @Desc
 * @author 52489
 * @date 2020年1月3日
 * @Version V1.0
 */
public class A20200103_sigleton_doubleCheck {

    private static int a = 10;

    private volatile static A20200103_sigleton_doubleCheck instance = null;

    private A20200103_sigleton_doubleCheck() {

    }

    public static A20200103_sigleton_doubleCheck getInstance() {
        if (null == instance) {
            synchronized (A20200103_sigleton_doubleCheck.class) {
                if (null == instance) {
                    instance = new A20200103_sigleton_doubleCheck();
                }
            }
        }

        return instance;
    }

    public int reduce() {
        return a--;
    }

    public static void main(String[] args) {
        A20200103_sigleton_doubleCheck a1 = A20200103_sigleton_doubleCheck.getInstance();
        A20200103_sigleton_doubleCheck a = A20200103_sigleton_doubleCheck.getInstance();
        System.out.println(a.reduce() + "__" + a1.reduce());

    }
}
